<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>token: {{ token }}</h2>
    <div>
      <ul>
        <p>id : {{ emp.id }}</p>
        <p>name : {{ emp.name }}</p>
        <p>age : {{ emp.age }}</p>
      </ul>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "Index",
  data() {
    return {
      msg: "登录成功啦！！！!!",
      token: "",
      emp: {},
    };
  },
  created() {
    var query = this.$route.query
    this.token = query.accessToken
    const token = query.accessToken
    this.axios
      .get("/devApi/emps", {
        headers: {
          authorization: `Bearer ${token}`,
        },
      })
      .then((res) => {
        console.log(res.data)
        this.emp = res.data
        // window.location.href=this.wxImg
      })
      .catch(function (error) {
        console.log(error);
      });
  },
  methods: {},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
